home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / monitor / timelo.arc / TIMELOG.DOC
Text File  |  1988-07-06  |  13KB  |  334 lines

  1.  
  2.     TIMELOG.DOC  contained in TIMELOG.ARC  - Network Poor User LOG program
  3.  
  4.     A simple but effective system of monitoring user use of the network.
  5.     Created by: Bruce Gregory  [75600,26]  
  6.     
  7.     Currently used on SFT Netware 2.1  SMC/ARCNET   MS-DOS 3.2
  8.     At present, has not been tested with other system configurations.
  9.  
  10.     One 3rd party program is required, this example requires the
  11.     use of Norton's TimeMark.exe; using the short name TM.exe, the rest
  12.     of the work is done with batch files and DOS environment strings.
  13.     TM.exe advantage is it's ability to maintain several stopwatches (4).
  14.     
  15.     The following is assumed in order for all to function properly:
  16.     Each, or a test user has their own home subdirectory i.e. SYS:CHRIS
  17.     This home subdirectory is their first mapped search drive & that
  18.     SYS:PUBLIC is the second search drive, others required can follow.
  19.     The SYS:LOGIN directory is not a mapped as a search drive.
  20.  
  21.     LOGIN AS SUPERVISOR  (on a sunday perhaps)
  22.  
  23. 1.    Create a subdirectory off the SYS: root called \TIMELOG
  24.  
  25. 2.   Give the Group EVERYONE (or test user) trustee rights to this directory
  26.  
  27. 3.   Place the following lines in the beginning of the 
  28.     system login script or user login script, whichever you prefer.
  29.     
  30.     DOS SET USER = "%LOGIN_NAME"
  31.     DOS SET STA# = "%P_STATION"
  32.  
  33.     If you are using only the SYSTEM login script file:
  34.     add the following line.
  35.     
  36.     EXIT "BEGIN"
  37.     
  38.     Else place it at the end of the individual user's login script.
  39.     
  40.     This will call the BEGIN.BAT file on exit from the login script.
  41.  
  42.  
  43. 4.   Locate and delete all copies of LOGIN.EXE & LOGOUT.EXE except for
  44.     those located in the SYS:LOGIN subdirectory.
  45.     In SYS:LOGIN  rename LOGOUT.EXE to BYENET.EXE
  46.                      and LOGIN.EXE  to NETLOGIN.EXE
  47.                   Flag these files SRO        
  48.  
  49. 5.   Create and copy the following files to the SYS:PUBLIC area and flag SRO
  50.     NOTE: If using a test user copy to the user's home directory
  51.  
  52.     Norton's TM.EXE program
  53.     BEGIN.BAT  - Explained below
  54.     LOGIN.BAT  -    "       "     titled for the \PUBLIC subdirectory
  55.     LOGOUT.BAT -    "       "        "    "   "     "        "
  56.      
  57.     Note: There are (2) versions of the LOGOUT.BAT file, please verify.
  58.  
  59.                                                             
  60. 6.   Create and copy the following files to the SYS:LOGIN area and flag SRO
  61.  
  62.     LOGIN.BAT  - Explained below  titled for the \LOGIN subdirectory
  63.     LOGOUT.BAT -    "       "        "    "   "     "        "
  64.  
  65.     Note: There are (2) versions of the LOGOUT.BAT file, please verify.
  66.  
  67.  
  68. The following batch files are required, explanations to follow:
  69.  
  70. ***BEGIN.BAT***
  71.  
  72.      rem   ********* Begin.bat file for SYS:PUBLIC  DIRECTORY **********
  73.     rem 
  74.     echo off                                                    
  75.     cls                                                         
  76.     TM START "%USER% @Sta_%STA#% LogIN  time " /C4/L >> \TIMELOG\%USER%.LOG
  77.     echo . >>\TIMELOG\%USER%.LOG                          
  78.     cd\%user%                                               
  79.     echo cd\%user% >\home.bat                          
  80.     IF X%1==XNOMENU GOTO BYPASS                             
  81.     menu user                                               
  82.     rem   Else exit to DOS
  83.     :BYPASS   
  84.     
  85. ******END BEGIN.BAT*******    
  86.  
  87.     Lets break these commands down.
  88.     
  89.     Suppose you had a user named CHRIS, s)he logs in to the system
  90.     from physical station 00000000000F at 10:21 am
  91.     
  92.     [TM START]  start the clock
  93.     
  94.     ["%USER% @Sta_%STA#% LogIN  time "] "Quoted" string (a Norton requirement)
  95.     
  96.     String converts to: ->CHRIS @Sta_00000000000F LogIN  time <-
  97.     because we previously passed Novell's  LOGIN_NAME  &  P_STATION 
  98.     to the (set) DOS environment string as %USER%  &  %STA#% respectively.
  99.  
  100.     [/C4]   Use Clock #4 (avoids conflict w/ clock #1, default for no params)
  101.  
  102.     [/L]    Left justify the string for the file
  103.      
  104.     [>>]    Dos redirection ( double >> ) for append to file
  105.  
  106.     [\TIMELOG\]  The subdirectory where the target files reside.
  107.     
  108.        [%USER%.LOG] The target file which is CHRIS.LOG, if the target
  109.                file does'nt exist it will be created by the batch file.
  110.  
  111.     [echo . >>\TIMELOG\%USER%.LOG]  Add a period and force a CR/LF sequence
  112.     
  113.     Now if we type(ed) the file:  TYPE \TIMELOG\CHRIS.LOG   the result,
  114.     (providing it was the first login ever) would be  as follows:
  115.      
  116.     CHRIS @Sta_00000000000F LogIN  time  10:21 am, Wednesday, July 6, 1988 .
  117.     (eof)
  118.     
  119.     Suppose now that CHRIS logs off the network at 3:52 PM, the logout
  120.     batch file would send a logout string with a time calculation providing
  121.     us with the following in the CHRIS.LOG file.
  122.     
  123.     CHRIS @Sta_00000000000F LogIN  time  10:21 am, Wednesday, July 6, 1988 .
  124.     CHRIS @Sta_00000000000F LogOUT time  3:52 pm, Wednesday, July 6, 1988
  125.     5 hours, 30 minutes, 12 seconds .
  126.     (eof) 
  127.     
  128.     A similar login the following day would append CHRIS.LOG & produce:
  129.     
  130.     CHRIS @Sta_00000000000F LogIN  time  10:21 am, Wednesday, July 6, 1988 .
  131.     CHRIS @Sta_00000000000F LogOUT time  3:52 pm, Wednesday, July 6, 1988
  132.     5 hours, 30 minutes, 12 seconds .
  133.     CHRIS @Sta_00000000000F LogIN  time  9:00 am, Thursday, July 7, 1988 .
  134.     CHRIS @Sta_00000000000F LogOUT time  4:00 pm, Thursday, July 7, 1988
  135.     7 hours, 0 minutes, 10 seconds .
  136.     (eof)
  137.     
  138.     Additional lines in this batch file are:
  139.     
  140.     [cd\%user%]  Change directories to SYS:CHRIS
  141.      
  142.     [echo cd\%user% > \home.bat]  Creates a HOME.BAT file with the following
  143.                              line in it: CD\CHRIS 
  144.                             This so the user can always return to their
  145.                             home directory by entering HOME on the
  146.                             command line. This file is always refreshed.
  147.                             
  148.     [IF X%1==XNOMENU GOTO BYPASS]  If Chris logged in i.e. LOGIN CHRIS NOMENU
  149.                              then bypass the menu calling program   
  150.  
  151.     [menu user]  Don't confuse USER with  %USER% - this line will only
  152.                work if there is a USER.MNU file in SYS:PUBLIC.
  153.                It could be "menu main" etc..  Change to suit.
  154.                Also requires MENU.EXE
  155.                    
  156.     [:BYPASS]   End of batch file, just exit to the operating system 
  157.     
  158. *****END EXPLANATION OF BEGIN.BAT******
  159.  
  160.  
  161. *****LOGIN.BAT******
  162.     
  163.      rem   ********* Login.bat file for SYS:PUBLIC  &  SYS:LOGIN
  164.     rem 
  165.     rem    Only required in SYS:PUBLIC if search mapping EXcludes 
  166.     rem    the \LOGIN subdirectory
  167.     rem    also to force a logout write to the user.log before a re-login
  168.     rem    while logged onto the network.               
  169.     echo off                                            
  170.     cls                                                 
  171.     f:                                                  
  172.     rem  if there is no f:\public then no need to write to the log
  173.     rem  chances are they are not on the network at all.
  174.     IF NOT EXIST F:\PUBLIC\*.* GOTO BYPASS              
  175.     rem
  176.     rem  However, if they are currently logged in, force a logout first
  177.     rem ******* send the logout date & time to the userlog
  178.     TM STOP "%USER% @Sta_%STA#% LogOUT time " /C4/L >>\TIMELOG\%USER%.LOG
  179.     echo . >>\TIMELOG\%USER%.LOG                      
  180.     CD\LOGIN                                            
  181.     :BYPASS
  182.     rem     Use this next line only if using the ANSI.SYS driver
  183.     rem     or delete it as you prefer, it's not required, I use it for format.
  184.     echo ^[[15B                                         
  185.     rem  LOGIN.EXE has been renamed NETLOGIN.EXE        
  186.     netlogin %1 %2 %3 %4 %5                             
  187.  
  188. *****END LOGIN.BAT*****                                                     
  189.                                                             
  190.                                                             
  191. *****LOGOUT.BAT******   for SYS:PUBLIC
  192.  
  193.     rem   ************** logout.bat file in SYS:PUBLIC  DIRECTORY**********
  194.     rem                                                         
  195.     rem    Only required if search mapping EXcludes the \LOGIN subdirectory  
  196.     REM
  197.     echo off                                                    
  198.     cls                                                         
  199.     f:                                                          
  200.     cd\login
  201.     rem  now call the extended version of logout.bat 
  202.     rem located in the sys:login directory
  203.     logout                                                      
  204.                                                             
  205. *****END LOGOUT.BAT*******  FOR SYS:PUBLIC
  206.  
  207.  
  208. *****LOGOUT.BAT********  FOR SYS:LOGIN
  209.  
  210.     rem   ************** logout.bat file in SYS:LOGIN  DIRECTORY***********
  211.     rem                                                         
  212.     echo off                                                    
  213.     cls                                                         
  214.     rem ******* send the logout date & time to the userlog      
  215.     TM STOP "%USER% @Sta_%STA#% LogOUT time " /C4/L >>\TIMELOG\%USER%.LOG
  216.     echo . >>\TIMELOG\%USER%.LOG                              
  217.     rem   LOGOUT.EXE has been renamed to BYENET.EXE             
  218.     byenet                                                      
  219.                                                             
  220. *****END LOGOUT.BAT*******  FOR SYS:LOGIN                                 
  221.                                                             
  222.                                                             
  223.  
  224. 7.    The following examples demonstrate tracking application use by user to
  225.     a \TIMELOG\USERNAME.APL  file.  Replace .APL with .LOG if you prefer
  226.     to have login/out and application use in the same file.
  227.     So as not to interfere with the login/logout timekeeping the clock 
  228.     #3 is used for applications.
  229.     
  230.     ADDITIONAL NOTE:  when redirecting with the %USER% string a single
  231.                    batch file can by used by all users which avoids
  232.                    individual batch file customization. 
  233.     
  234.  
  235.  
  236. *****A SAMPLE LOTUS-123 BATCH FILE USING CLOCK #3 ********
  237.     called by user BRIAN
  238.     
  239.     echo off
  240.     cls
  241.     CD\123
  242.     TM START "%USER%  START LOTUS 123 " /C3/L >>\TIMELOG\%USER%.APL
  243.      echo . >>\TIMELOG\%USER%.APL
  244.     LOTUS
  245.     TM STOP  "%USER%  STOP  LOTUS 123 " /C3/L >>\TIMELOG\%USER%.APL
  246.     echo . >>\TIMELOG\%USER%.APL
  247.     HOME
  248. *****END LOTUS 123 BATCH FILE EXAMPLE******
  249.  
  250.     Resulting in a \TIMELOG\BRIAN.ASC file that might look like:
  251.     
  252.     BRIAN  START LOTUS 123  2:32 pm, Tuesday, July 5, 1988 .
  253.     BRIAN  STOP  LOTUS 123  5:15 pm, Tuesday, July 5, 1988
  254.     2 hours, 42 minutes, 48 seconds ... 
  255.     BRIAN  START LOTUS 123  9:16 am, Wednesday, July 6, 1988 .
  256.     BRIAN  STOP  LOTUS 123  4:32 pm, Wednesday, July 6, 1988
  257.     7 hours, 15 minutes, 38 seconds ... 
  258.     (eof)
  259.     
  260.  
  261. *****A SAMPLE MULTIMATE BATCH FILE USING CLOCK #3 ********
  262.     called by user JAY
  263.     
  264.     echo off
  265.     cls
  266.     TM START "%USER%  START MULTIMATE " /C3/L >>\TIMELOG\%USER%.APL
  267.      echo . >>\TIMELOG\%USER%.APL
  268.     cd\wordpro
  269.     MM
  270.     TM STOP  "%USER%  STOP  MULTIMATE " /C3/L >>\TIMELOG\%USER%.APL
  271.     echo ... >>\TIMELOG\%USER%.APL
  272.     home
  273. *****END MULTIMATE BATCH FILE EXAMPLE******
  274.  
  275.     Resulting in a \TIMELOG\JAY.ASC file that might look like:
  276.     
  277.     JAY  START MULTIMATE  12:28 pm, Thursday, June 30, 1988 .
  278.     JAY  STOP  MULTIMATE  12:51 pm, Thursday, June 30, 1988
  279.     23 minutes, 15 seconds ... 
  280.     JAY  START LOTUS 123  2:32 pm, Tuesday, July 5, 1988 .
  281.     JAY  STOP  LOTUS 123  5:15 pm, Tuesday, July 5, 1988
  282.     2 hours, 42 minutes, 48 seconds ... 
  283.     JAY  START MULTIMATE  10:24 am, Wednesday, July 6, 1988 .
  284.     JAY  STOP  MULTIMATE  12:14 pm, Wednesday, July 6, 1988
  285.     1 hour, 50 minutes, 11 seconds ... 
  286.     JAY  START MULTIMATE  12:19 pm, Wednesday, July 6, 1988 . 
  287.     JAY  STOP  MULTIMATE  12:24 pm, Wednesday, July 6, 1988
  288.     5 minutes, 18 seconds ... 
  289.     JAY  START MULTIMATE  12:43 pm, Wednesday, July 6, 1988 . 
  290.     JAY  STOP  MULTIMATE  12:56 pm, Wednesday, July 6, 1988
  291.     12 minutes, 38 seconds ... 
  292.     
  293.     
  294. 8.   This example, and for now the last, enables a second use of the
  295.     %STA#% information.  Suppose you only have two workstations with
  296.     the ability to work with graphics programs and they are; physical 
  297.     station# 000000000002  and physical station# 00000000000A:
  298.     
  299.     echo off
  300.     cls
  301.     if X%
  302.     IF X%STA#%==X000000000002 GOTO DOGRAPH
  303.     IF X%STA#%==X00000000000A GOTO DOGRAPH    
  304.     GOTO BYPASS
  305.     :DOGRAPH
  306.     cd\GrafStuf
  307.     GRAPHDO    
  308.     :BYPASS
  309.     HOME
  310.  
  311.     Simple, but effective.  Of course you could create the example batch
  312.     file with prompts to the user so as to let them know that they are
  313.     logged into the wrong workstation for graphics etc.
  314.     
  315.  
  316. ******** C L O S I N G   N O T E S **************
  317.     
  318.  
  319.     I must admit that my approach is less than elegant, has it's down sides
  320.     and in no way compares with some of the packaged stuff on the market today.
  321.     It has provided me with useful information in determining user activity
  322.     on a (16) station (22) user system    of moderate use and I hope you find 
  323.     it to be helpful in some way.  One up side is it's cost! Zilch.
  324.     
  325.     Questions, comments and/or suggestions are welcome.
  326.     
  327.     Bruce Gregory
  328.     SOS MicroResources
  329.     20 Troy Road
  330.     Whippany, NJ  07981
  331.     (201) 503-0393
  332.  
  333. (eof)            
  334.